<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                template="./../templates/base.xhtml"
                xmlns:p="http://primefaces.org/ui">
<ui:define name="content">

    #{homeController.accesoURL(false, "/menu/index")}
    <f:view>
        <h:form>

            <p:dataTable value="#{menuController.listado()}" var="item" 
                         paginator="true" rows="10" rowsPerPageTemplate="5,10,15">
                    <f:facet name="header">  
                        OPCIONES DE MENU 
                    </f:facet>>

                <p:column>
                    <f:facet name="header"> <h:outputText value="ID"/> </f:facet>
                    <h:outputText value="#{item.id}"/>
                </p:column>

                <p:column>
                    <f:facet name="header"> <h:outputText value="Nombre"/> </f:facet>
                    <h:outputText value="#{item.nombre}"/>
                </p:column>

                <p:column>
                    <f:facet name="header"> <h:outputText value="Action"/> </f:facet>
                    <h:outputText value="#{item.action}"/>
                </p:column>

                <p:column>
                    <f:facet name="header"> <h:outputText value="URL"/> </f:facet>
                    <h:outputText value="#{item.url}"/>
                </p:column>

                <p:column>
                    <f:facet name="header"> <h:outputText value="Raiz"/> </f:facet>
                    <h:outputText value="#{item.raiz}"/>
                </p:column>

                <p:column>
                    <f:facet name="header"> <h:outputText value="Orden"/> </f:facet>
                    <h:outputText value="#{item.orden}"/>
                </p:column>

                <p:column>
                    <f:facet name="header"> <h:outputText value="Modificado"/> </f:facet>
                    <h:outputText value="#{item.updated}">
                        <f:convertDateTime pattern="dd/MM/yyyy HH:mm:ss" />
                    </h:outputText>
                </p:column>

                <p:column>
                    <f:facet name="header"> <h:outputText value=""/> </f:facet>
                    <h:commandLink action="#{menuController.edit(item.id)}">
                        <h:graphicImage library="images" name="edit.gif" title="editar" />
                    </h:commandLink>
                </p:column>

                <p:column>
                    <f:facet name="header"> <h:outputText value=""/> </f:facet>
                    <h:commandLink action="#{menuController.eliminar(item.id)}">
                        <h:graphicImage library="images" name="delete.gif" title="eliminar" />
                    </h:commandLink>
                </p:column>

            </p:dataTable>

            <p:commandButton action="#{menuController.create()}" value="NUEVO"/>
                

        </h:form>

    </f:view>

</ui:define>
</ui:composition>
